// Cell.cpp : implementation file
//

#include "stdafx.h"
#include "assit.h"
#include "Cell.h"
#include "ProgressView.h"


// CCell

IMPLEMENT_DYNAMIC(CCell, CEdit)

CCell::CCell(CProgressView* pView, int row, int col)
{
	m_pView = pView;
	m_row = row;
	m_col = col;
}

CCell::~CCell()
{
}


BEGIN_MESSAGE_MAP(CCell, CEdit)
	ON_WM_KILLFOCUS()
	ON_WM_SETFOCUS()
	ON_WM_CHAR()
END_MESSAGE_MAP()



// CCell message handlers




void CCell::OnKillFocus(CWnd* pNewWnd)
{
	CEdit::OnKillFocus(pNewWnd);

	m_pView->updateItem(m_row);
	// TODO: Add your message handler code here
}


void CCell::OnSetFocus(CWnd* pOldWnd)
{
	CEdit::OnSetFocus(pOldWnd);

	// TODO: Add your message handler code here
}


void CCell::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// TODO: Add your message handler code here and/or call default
	if(nChar == VK_TAB)
	{
		CCell* pCell = m_pView->getNextCell(m_row, m_col);
		if(pCell)
			pCell->SetFocus();
		return;
	}

	CEdit::OnChar(nChar, nRepCnt, nFlags);
}
